Fix accessibility not getting initialized in gtk_init() if a default display is alrea...
authorChristoph Reiter <reiter.christoph@gmail.com>
Tue, 6 Oct 2015 22:00:35 +0000 (00:00 +0200)
committerChristoph Reiter <creiter@src.gnome.org>
Tue, 6 Oct 2015 22:19:32 +0000 (00:19 +0200)
_gtk_accessibility_init() only gets called if the default
display changes, but in case gdk_init() is called before gtk_init()
the default display is already set and no property notification occurs.

This can happen quite easily in pygobject where
"from gi.repository import Gdk, Gtk"
will call gdk_init() followed by gtk_init() in the Python overrides.

This fixes it by checking for a default display in all cases.

gtk/gtkmain.c

index c2a439c17a117f67a59eb72575297866075a4b62..0a14f209cfb76f0adc7fb97e49ed0a37bbaeb23a 100644 (file)
@@ -698,6 +698,8 @@ static void
 do_post_parse_initialization (int    *argc,
                               char ***argv)
 {
+  GdkDisplayManager *display_manager;
+
   if (gtk_initialized)
     return;
 
@@ -737,7 +739,11 @@ do_post_parse_initialization (int    *argc,
       _gtk_modules_init (argc, argv, NULL);
     }
 
-  g_signal_connect (gdk_display_manager_get (), "notify::default-display",
+  display_manager = gdk_display_manager_get ();
+  if (gdk_display_manager_get_default_display (display_manager) != NULL)
+    _gtk_accessibility_init ();
+
+  g_signal_connect (display_manager, "notify::default-display",
                     G_CALLBACK (default_display_notify_cb),
                     NULL);
 }